package com.eco
{
	import com.eco.*;
	import com.framework.*;
	
	import flash.display.MovieClip;
	import flash.events.*;
	import flash.utils.*;
	
	//啦啦啦，可怕的无敌道具，
	//触发时，让全场敌人以卫士为中心向外炸开，触发后，卫士进入霸体状态，同时移动速度提升，撞击力也变得十分强劲
	public class BonusInvincible extends Bonus
	{
		private var iSuperArmor:int;
		private var iNormalSensitivity:int;
		private var iNormalMass:int;
		
		public function BonusInvincible(r:int=10, type:int=0)
		{
			super( 8, Bonus.BONUS_INVINCIBLE);
			
			iFunctionTime = 8000;//8秒
		}
		
		override public function StartFunction():void
		{
			if( ftFighter == null )
				return;
			
			CreateSoundEvent( CustomEventSound.PLAY_SOUND, SoundInfo.EFF_BONUS_INVINCIBLE_ACTIVE);
			
			//冲击波效果
			var i:int = 0;
			for( i=0; i<vecEnemy.length; i++)
			{
				vecEnemy[i].v2dSpeed.x = vecEnemy[i].x - ftFighter.x;
				vecEnemy[i].v2dSpeed.y = vecEnemy[i].y - ftFighter.y;
				vecEnemy[i].v2dSpeed.setLength(2);
				vecEnemy[i].x += (vecEnemy[i].x - ftFighter.x)/4;
				vecEnemy[i].y += (vecEnemy[i].y - ftFighter.y)/4;
			}
			
			//霸体效果
			iSuperArmor = ftFighter.iSuperArmor;
			ftFighter.iSuperArmor = 999;
			
			//加速效果
			iNormalSensitivity = ftFighter.iNormalSensitivity;
			ftFighter.iNormalSensitivity /= 2;
			
			//强力撞击效果
			iNormalMass = ftFighter.iNormalMass;
			ftFighter.iNormalMass *= 10;
			
			super.StartFunction();
		}
		
		override public function StopFunction():void
		{
			ftFighter.iSuperArmor = iSuperArmor;
			ftFighter.iNormalSensitivity = iNormalSensitivity;
			ftFighter.iNormalMass = iNormalMass;
			
			super.StopFunction();
		}
	}
}